package com.heima.article.task;

import com.heima.article.service.IHotArticleService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class HotArticleTask {
    @Autowired
    private IHotArticleService hotArticleService;

    @XxlJob("hotArticleHandler")
    public ReturnT computeHotArticleJob(String param) throws  Exception{
        log.debug("热点文章开始计时");
        //调用计算服务
        hotArticleService.compute();
        return ReturnT.SUCCESS;
    }

    @XxlJob("helloHandler")
    public ReturnT hello(String param) throws Exception{
        log.debug("开始测试");
        System.out.println("试试");
        return ReturnT.SUCCESS;
    }
}
